package cn.iocoder.boot.controller.admin.gc;

import cn.iocoder.boot.dto.ComponentPageDTO;
import cn.iocoder.boot.dto.gc.TemplateFields;
import cn.iocoder.boot.service.GcService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import org.springframework.web.bind.annotation.*;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "国创资源库")
@RestController
@RequestMapping("/gc")
public class GcController {

    @Resource
    private GcService gcService;

    @PermitAll
    @GetMapping("/getToken")
    @Operation(summary = "获取token")
    public CommonResult<?> getToken() {
        return success(gcService.getToken());
    }
    @PostMapping("/createComponents")
    @Operation(summary = "新建元器件")
    public CommonResult<?> createComponents(@RequestBody ComponentPageDTO componentPageDTO) {
        return success(gcService.createComponents(componentPageDTO));
    }
}